# -*- mode: org; -*-
#+TITLE: Debug Ports using Netcat
#+AUTHOR: Zelphir Kaltstahl
#+EMAIL: zelphirkaltstahl@posteo.de
#+STARTUP: content indent align inlineimages hideblocks entitiesplain nologdone nologreschedule nologredeadline nologrefile
#+TODO: TODO WIP DEPRECATED | DONE
#+DATE: [2022-01-09 Sun]
#+KEYWORDS: netcat network port port-forwarding
#+LANGUAGE: English
#+PRIORITIES: A E E
#+EXCLUDE_TAGS: noexport
#+OPTIONS: ^:{}
#+OPTIONS: H:10
#+OPTIONS: toc:2
#+OPTIONS: tags:nil
#+OPTIONS: tasks:t
#+OPTIONS: H:6
#+OPTIONS: p:nil
#+OPTIONS: pri:nil
#+OPTIONS: prop:nil
#+OPTIONS: todo:t
#+OPTIONS: stat:nil
#+OPTIONS: |:t
#+OPTIONS: inline:nil
#+OPTIONS: date:t

* Listen for connections on a port

On the server run netcat to listen for any connections and receive messages on a port:

#+begin_src shell
# verbose verbose listen numeric port 443
netcat -v -v -l -n -p 443
#+end_src

This is for TCP connections. If you want to test for UDP protocol, you will need to add a =-u= to the command:

#+begin_src shell
# verbose verbose listen numeric port 443
netcat -v -v -l -n -u -p 17000
#+end_src

* Connect to server

Next connect to the server, to check, whether a firewall blocks the connection:

#+begin_src shell
netcat domain_or_ip_address 443
test
#+end_src

Then =test= should appear as text output on the server.
